import {Component, Input, ViewChild} from '@angular/core';
import {NavController, Slides, ModalController, ViewController} from 'ionic-angular';

/*
  Generated class for the PhotoViewer page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  selector: 'page-photo-viewer',
  templateUrl: 'photo-viewer.html'
})
export class PhotoViewerPage {

  @ViewChild(Slides) slides: Slides;

  initialSlide: number = 0;

  @Input()
  imgUrls: Array<string> = [];

  constructor(public viewCtrl: ViewController, public navCtrl: NavController, public modalCtrl: ModalController) {
    if (viewCtrl.data.imgUrls)
    {
      this.imgUrls = viewCtrl.data.imgUrls;
    }
    if (viewCtrl.data.idx)
    {
      this.initialSlide = viewCtrl.data.idx;
    }

  }
  dismiss() {
    this.viewCtrl.dismiss();
  }
  ionViewDidLoad() {
    this.slides.zoom = true;
  }

  public onSlideChanged() {
    if (this.slides.getSlider()) {
    }
  }

  scale: number = 1;

  // scaleImg(e: any)
  // {
  //   let zi = new Animation(e.target)
  //     .duration(230)
  //     .easing('linear');
  //   let za = new Animation();
  //   za.add(zi);
  //   if (this.scale > 1) {
  //     zi.from('scale', this.scale);
  //     zi.to('scale', 1);
  //     za.play();
  //     this.scale = 1;
  //   }
  //   else {
  //     zi.from('scale', this.scale);
  //     zi.to('scale', 3);
  //     za.play();
  //     this.scale = 3;
  //   }
  //
  // }
}
